//
//  sql.h
//  悬浮按钮demo
//
//  Created by lzy on 2018/2/1.
//  Copyright © 2018年 lzy. All rights reserved.
//

#ifndef sql_h
#define sql_h


#endif /* sql_h */
//摇一摇活动sql
/**
SELECT tb.formatTime,
SUM(if(tb.`Code`=641,tb.sum1,0)) "app点击抽签页启动图片次数" ,
SUM(if(tb.`Code`=641 AND tb.UserId>0,tb.sum1,0)) "app点击抽签页启动图片次数 登陆用户" ,
SUM(if(tb.`Code`=641 AND tb.UserId=0,tb.sum1,0)) "app点击抽签页启动图片次数 未登陆" ,
SUM(if(`Code`=642 AND Remark LIKE '%app%',tb.sum1,0)) "app里摇一摇次数" ,
SUM(if(`Code`=642 AND Remark LIKE '%app%' AND UserId>0,tb.sum1,0)) "app里摇一摇次数 登陆用户" ,
SUM(if(`Code`=642 AND Remark LIKE '%app%' AND UserId=0,tb.sum1,0)) "app里摇一摇次数 未登陆" ,
SUM(if(`Code`=642 AND Remark LIKE '%微信%',tb.sum1,0)) "微信里摇一摇次数" ,
SUM(if(tb.`Code`=643,tb.sum1,0)) "app点击分享图片按钮次数" ,
SUM(if(tb.`Code`=643 AND tb.UserId>0,tb.sum1,0)) "app点击分享图片按钮次数 登陆用户" ,
SUM(if(tb.`Code`=643 AND tb.UserId=0,tb.sum1,0)) "app点击分享图片按钮次数 未登陆",
SUM(if(tb.`Code`=644,tb.sum1,0)) "app点击右上角分享网页按钮次数",
SUM(if(tb.`Code`=644 AND tb.UserId>0,tb.sum1,0)) "app点击右上角分享网页按钮次数 登陆用户",
SUM(if(tb.`Code`=644 AND tb.UserId=0,tb.sum1,0)) "app点击右上角分享网页按钮次数 未登陆"
FROM
(SELECT DATE_FORMAT(CreateTime, '%Y-%m-%d') formatTime,`Code`,COUNT(*) sum1,Remark,UserId from userlogs
 WHERE CreateTime > '2018-01-25' AND `Code`>640 AND `Code`<645
 GROUP BY formatTime,`Code`,Remark,UserId ) tb GROUP BY tb.formatTime;
*/
